#include <iostream>
using namespace std;

int f(int x)
{
    if (x == 0)
        return 0;
    return x % 10 + f(x / 10);
}

int g(int x)
{
    if (x == 0)
        return 0;
    return (x & 0b1) + g(x >> 1);
}

int main()
{
    int n = 21;
    int count = 0;
    for (int i = 1; i <= n; i++)
    {
        if (f(i) == g(i))
        {
            count++;
            cout << i << " ";
        }
    }
    cout << "\ncount=" << count << endl;

    return 0;
}